package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DAOConnection {
	
	public static Connection connect() {
		Connection connection = null;
		String url = "jdbc:sqlserver://MyPC:1433;databasename=car;username=sa;password=sungold;";
		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
			connection = DriverManager.getConnection(url);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			return null;
		} catch (SQLException e) {
			System.out.println("Connection failed");
			e.printStackTrace();
		} 
		return connection;

	}

	public static void main(String[] args) {
		System.out.println(connect());

	}
	
}
